package com.xucy.springboot.jmx;

import javax.management.JMException;
import javax.management.MBeanServer;
import javax.management.ObjectName;
import java.lang.management.ManagementFactory;

/**
 * @Author xucy
 * @Date 2019-12-09 16:04
 * @Description
 **/

public class HelloAgent {

    public static void main(String[] args) throws JMException, Exception
     {
          MBeanServer server = ManagementFactory.getPlatformMBeanServer();
          ObjectName helloName = new ObjectName("jmxBean111:name=hello11");

          server.registerMBean(new Hello(), helloName);

          Thread.sleep(60*60*1000);
   }
}
